// Functions to read and parse configuration parameters
// and problem instance to be solved!
// It reads the supplied filename and parses the data
// into a NFS_instance struct.
// pleslie@diku.dk - 2004
#ifndef _NFSINPUT_H
#define _NFSINPUT_H

#include <NTL/ZZ.h>
#include <NTL/RR.h>
#include <NTL/ZZX.h>

struct NFS_instance{
	NTL::ZZ n;
	NTL::ZZ cofactor;
	NTL::ZZ primebound;
	NTL::ZZ rfb_bound;
	NTL::ZZ afb_bound;
	NTL::ZZ qcb_num;
	std::string primefile;
	NTL::ZZ C;
};

struct nfsPoly {
	NTL::ZZX f;
	NTL::ZZ m;
	NTL::RR alpha;
	NTL::RR rating;
};

extern NFS_instance readData(char* fname);
extern void storePoly(nfsPoly poly, char* fname);
extern nfsPoly readPoly(char* fname);
extern void printPoly(nfsPoly& poly);
extern NTL::ZZ Evalf(NTL::ZZX& f,NTL::ZZ& j);
extern NTL::ZZ EvalF(NTL::ZZX f,NTL::ZZ x,NTL::ZZ y );
extern NTL::ZZ NormF(NTL::ZZX f,NTL::ZZ x,NTL::ZZ y );
extern NTL::RR EvalF(NTL::ZZX f,NTL::RR x,NTL::RR y );
extern NTL::ZZ EvalfmodP(NTL::ZZX& f,NTL::ZZ& j,NTL::ZZ& p);
bool IsIrreducible(NTL::ZZX f, NTL::ZZ q);
extern int Legendre(NTL::ZZ& a, NTL::ZZ& b);
extern long LineCount(char* filename ); 
#endif
